<html>
<head>
<title>Prime Numbers</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="font-family:courier new;">
<pre>
<script>

function Pt(x,y){
	this.x=x;
	this.y=y;
}

function Map(x,y){
	this.m = [];
	for(var i=0;i<x;i++){
		this.m[i]=[];
		for(var j=0;j<y;j++){
			this.m[i][j]=0;
		}
	}
}

Map.prototype = {
	get : function(x,y){
		this.m[x][y];
	},
	get2 : function(p){
		this.m[p.x][p.y];
	}
}

function Map2(x,y){
	this.x = x;
	this.m = [];
	for(var i=0;i<x*y;i++){
		this.m[i]=0;
	}
}

Map2.prototype = {
	get : function(x,y){
		this.m[y*this.x+x];
	}
}

function time() {
	return new Date().getTime();
}

var m = new Map(1000,9000);
var t = time();
for(var x=0;x<1000;x++){
	for(var y=0;y<9000;y++){
		m.get(x,y);
	}
}
var e = time();
document.writeln(e-t);

var t = time();
var p = new Pt(0,0);
for(var p.x=0;p.x<1000;p.x++){
	for(var y=0;y<9000;y++){
		p.y=y
		m.get2(p);
	}
}
var e = time();
document.writeln(e-t);
</script>
</pre></body>
</html>
